package cc.htdf.gwc.forecast.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;

import javax.sql.DataSource;

/**
 * Created by JT on 2017/10/9.
 */
@Configuration
public class DbConfig {


    @Bean
    @ConfigurationProperties(prefix = "ali.information_us.datasource")
    public DataSource aliDataSource() {
        return new DriverManagerDataSource();
    }


    @Primary
    @Bean(value = "ali.information_us")
    public JdbcTemplate aliJdbcTemplate() {
        return new JdbcTemplate(aliDataSource());
    }
}
